.TH std::source_location::column 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::source_location::column \- std::source_location::column

.SH Synopsis
   constexpr std::uint_least32_t column() const noexcept;  \fI(since C++20)\fP

   Returns an implementation-defined value representing some offset from the start of
   the line represented by this object (i.e., the column number). Column numbers are
   presumed to be 1-indexed.

.SH Parameters

   \fI(none)\fP

.SH Return value

   An implementation-defined value representing some offset from the start of the line
   represented by this object (i.e., the column number).

   An implementation is encouraged to use 0 when the column number is unknown.

.SH Example


// Run this code

 #include <iostream>
 #include <source_location>

 template<typename T = std::source_location>
 inline void pos(const T& location = T::current())
 {
     std::cout
         << "("
         << location.line()
         << ':'
         << location.column()
         << ") ";
 }

 int main()
 {
 //      ↓: column #9
     pos(); std::cout << "Proxima\\n";    // row #18
       pos(); std::cout << "Centauri\\n"; // row #19
 //        ↑: column #11
 }

.SH Possible output:

 (18:9) Proxima
 (19:11) Centauri

.SH See also

   line          return the line number represented by this object
                 \fI(public member function)\fP
   file_name     return the file name represented by this object
                 \fI(public member function)\fP
   function_name return the name of the function represented by this object, if any
                 \fI(public member function)\fP
   Filename and line information
